#include "Command.hpp"
#include "TcpServer.hpp"

void Usage(const std::string &proc)
{
    std::cout<<"Usage: "<<proc <<" port"<<std::endl;
}

int main(int argc,char* argv[])
{
    if(argc!=2)
    {
        Usage(argv[0]);
        return 0;
    }

    uint16_t port = std::stoi(argv[1]);

    Command cmd;

    std::unique_ptr<TcpServer> tser = std::make_unique<TcpServer>
    (port,std::bind(&Command::Excute,&cmd,std::placeholders::_1,std::placeholders::_2));

    tser->Init();
    tser->Run();

    return 0;
}